package com.trt.eatmeat.test;

import java.util.HashMap;
import java.util.Map;

import cn.hutool.json.JSONUtil;

/**
 *  业务工具类
 */
public class BusinessInner {
    /**
     * 内外请求get
     * @param
     * @param
     * @return
     */
    public Map<String,Object> login(String userId,String password){
        String url = ContantUtils.inner_login;
        Map<String,Object> param = new HashMap<>();
        param.put("loginid",userId);
        param.put("userpassword",password);
        param.put("logintype","1");
        param.put("isie","false");
        Map<String,Object> response= HttpOAUtil.innerPost(url, param);
        return response;
    }

    /**
     *  约餐
     * @param currentData
     * @param userId
     * @param type
     * @return
     */
    public Map<String,Object> subscript(String currentData,String userId,int type){
        String url = ContantUtils.inner_subscript;
        Map<String,Object> param = new HashMap<>();
        if(type==1){
            param.put("jsondata","[{\"date\":\""+currentData+"\",\"userid\":"+userId+",\"type\":0,\"val\":0}]"); // 早餐预约
        }else if(type==2){
            param.put("jsondata","[{\"date\":\""+currentData+"\",\"userid\":"+userId+",\"type\":0,\"val\":1}]"); // 早餐取消
        }else if(type==3){
            param.put("jsondata","[{\"date\":\""+currentData+"\",\"userid\":"+userId+",\"type\":1,\"val\":0}]"); // 午餐预约
        }else if(type==4){
            param.put("jsondata","[{\"date\":\""+currentData+"\",\"userid\":"+userId+",\"type\":1,\"val\":1}]"); // 午餐取消
        }
        Map<String,Object> response= HttpOAUtil.innerPost(url, param);
        return response;
    }



}
